"""
Utility functions
"""

function parse_duration(duration_str::String)
    # Simple duration parser
    if endswith(duration_str, "s")
        return parse(Float64, duration_str[1:end-1])
    elseif endswith(duration_str, "m")
        return parse(Float64, duration_str[1:end-1]) * 60.0
    elseif endswith(duration_str, "h") 
        return parse(Float64, duration_str[1:end-1]) * 3600.0
    else
        return parse(Float64, duration_str)
    end
end

function spherical_to_cartesian(r, theta, phi)
    x = r * sin(theta) * cos(phi)
    y = r * sin(theta) * sin(phi) 
    z = r * cos(theta)
    return (x, y, z)
end

function cartesian_to_spherical(x, y, z)
    r = sqrt(x^2 + y^2 + z^2)
    theta = acos(z / r)
    phi = atan(y, x)
    return (r, theta, phi)
end